if num_lst[0] == 0 or num_lst[1] == 0: print('0 0') else: output_lst = [] for i in range(0,len(num_lst),2): if num_lst[i+1] == 0: break else: output_lst.append(num_lst[i] * num_lst[i+1]) output_lst.append(num_lst[i+1] - 1) output_str = [str(i) for i in output_lst] print(' '.join(output_str))
int main() { int a; int n; int flag = 0; while ( scanf("%d%d", &a, &n) != EOF ) { if ( n ) { if ( flag ) { printf(" "); } printf("%d %d", a*n, n-1); flag = 1; } if ( !flag ) { printf("0 0"); } } return 0; }